﻿using System;
namespace OpenComposite.EII.Interfaces
{
	public interface ITaskListService
	{
		event ITaskItemEventHandler TaskItemAction;

		int Add(object taskListKey, TaskItemType type, TaskStatus status, object tag, string description);
		int Add(object taskListKey, TaskItemType type, TaskStatus status, object tag, string description, string category);
		int Add(object taskListKey, TaskItemType type, TaskStatus status, object tag, string description, string category, string sourceName);

		int Insert(object taskListKey, int index, TaskItemType type, TaskStatus status, object tag, string description);
		int Insert(object taskListKey, int index, TaskItemType type, TaskStatus status, object tag, string description, string category);
		int Insert(object taskListKey, int index, TaskItemType type, TaskStatus status, object tag, string description, string category, string sourceName);

		void Clear();
		void Clear(object taskListKey);
		void Clear(object taskListKey, string category);

		ITaskItem this[object taskListKey, int index] { get; set; }

		int GetViewItemCount(object taskListKey);

		object GetView(object taskListKey);
	}
	public interface ITaskItem
	{
		int Index { get; }
		string Description { get; set; }
		string Category { get; set; }
		string SourceName { get; set; }
		object Tag { get; set; }
		TaskStatus Status { get; set; }
		TaskItemType Type { get; set; }
	}
	public enum TaskItemType
	{
		None = 0,
		Error,
		Warning,
		Message,
		Task,
		UserTask
	}
	public enum TaskStatus
	{
		None = 0,
		Unknown,
		OK,
		Todo
	}

	public delegate void ITaskItemEventHandler(object sender, ITaskItemEventArgs e);
	public class ITaskItemEventArgs : EventArgs
	{
		public ITaskItemEventArgs(object taskListKey, ITaskItem taskItem)
		{
			_taskListKey = taskListKey;
			_taskItem = taskItem;
		}
		private readonly object _taskListKey;
		public object TaskListKey
		{
			get { return _taskListKey; }
		}
		private readonly ITaskItem _taskItem;
		public ITaskItem TaskItem
		{
			get { return _taskItem; }
		}
	}
}
